package org.zfes.snowier.zbss.xzy.router.face;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.zbss.xzy.biz.face.model.FaceAlertRecord;
import org.zfes.snowier.zbss.xzy.biz.face.service.IFaceAlertRecordService;
import org.zfes.snowier.core.data.SelectVo;
@Controller 
@RequestMapping("/face")
public class FaceAlertRecordController implements BaseController {

	
	@Autowired
	private IFaceAlertRecordService faceAlterRecordService;
	
	//@RequiresPermissions(value="faceAlterRecord:loadFaceAlterRecordDataSet",desc="人脸预警记录列表")
    @RequestMapping(value="/loadFaceAlterRecordDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadFaceAlterRecordDataSet(@RequestBody Map<String,Object> params){
	    DataSet dataSet=  faceAlterRecordService.loadFaceAlterRecordDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
	//@RequiresPermissions(value="faceAlterRecord:createFaceAlterRecord",desc="人脸预警记录添加")
    @RequestMapping(value="/createFaceAlterRecord", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public  @ResponseBody Object createFaceAlterRecord(@RequestBody FaceAlertRecord faceAlterRecord){
		faceAlterRecordService.createFaceAlterRecord(faceAlterRecord);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
	//@RequiresPermissions(value="faceAlterRecord:loadFaceAlterRecord",desc="人脸预警记录加载")
    @RequestMapping(value="/loadFaceAlterRecord/{id}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadFaceAlterRecord(@PathVariable("id")Long id){
		Optional<FaceAlertRecord> ops = faceAlterRecordService.loadFaceAlterRecordById(id);
		return ajaxQuery("faceAlterRecord",ops);
    }
	
	//@RequiresPermissions(value="faceAlterRecord:updateFaceAlterRecord",desc="人脸预警记录更新")
    @RequestMapping(value="/updateFaceAlterRecord", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object updateFaceAlterRecord(@RequestBody  FaceAlertRecord faceAlterRecord){
		faceAlterRecordService.updateFaceAlterRecord(faceAlterRecord);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
	//@RequiresPermissions(value="faceAlterRecord:deletFaceAlterRecord",desc="人脸预警记录删除")
    @RequestMapping(value="/deleteFaceAlterRecord/{id}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object deleteFaceAlterRecord(@PathVariable("id")Long id){
		faceAlterRecordService.deleteFaceAlterRecord(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }


    @RequestMapping(value="/loadFaceAlterRecordSelectVo", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadFaceAlterRecordSelectVo(){
		 List<SelectVo>  ops = faceAlterRecordService.loadFaceAlterRecordSelectVo("");
		return ajaxQuery("selectVo",ops);
    }
    
}